package com.his.struts.dao.diseaseInfo;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import com.his.struts.action.MedicineAction;
import com.his.struts.form.DiseaseInfoForm;
import com.his.struts.form.diseaseInfo.AgodistimeForm;
import com.his.struts.form.diseaseInfo.BasicInfoForm;
import com.his.struts.form.diseaseInfo.EstimateForm;
import com.his.struts.form.diseaseInfo.FemaleForm;
import com.his.struts.form.diseaseInfo.FimilyForm;
import com.his.struts.form.diseaseInfo.HurtForm;
import com.his.struts.form.diseaseInfo.LivingForm;
import com.his.struts.form.diseaseInfo.YinshiForm;
import com.his.struts.util.DbUtil;

public class DiseaseInfoImp implements DiseaseInfoDao {

	
	DbUtil db = new DbUtil();
	Logger log =Logger.getLogger(DiseaseInfoImp.class);
	/**
	 * 添加用户病例信息
	 * @param diseaseInfo 病例信息
	 */
	public void addDiseaseInfo(DiseaseInfoForm diseaseInfo) {
		
		int uid = diseaseInfo.getUid();
		
		// 以往病例史
		AgodistimeForm ago = diseaseInfo.getAgo();
		String agoSql = "insert into dis_agodistime values(?,?,?,?,?,?,?,?,?,?)";
		ArrayList agoList = new ArrayList();
		agoList.add(uid);
		agoList.add(ago.getTwo_bloodPressure());
		agoList.add(ago.getTwo_diabetes());
		agoList.add(ago.getTwo_heartDis());
		agoList.add(ago.getTwo_malignancy());
		agoList.add(ago.getTwo_copd());
		agoList.add(ago.getTwo_tuberculosis());
		agoList.add(ago.getTwo_schiz());
		agoList.add(ago.getTwo_pneumonia());
		agoList.add(ago.getTwo_others());
		db.executeUpdate(agoSql, agoList);
		db.closeAll();
		
		// 基本信息表
		BasicInfoForm basic = diseaseInfo.getBasic();
		String basicSql = "insert into dis_basicinfo values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		ArrayList basicList = new ArrayList();
		basicList.add(uid);
		basicList.add(basic.getO_name());
		basicList.add(basic.getO_sex());
		basicList.add(basic.getO_birth());
		basicList.add(basic.getO_idcard());
		basicList.add(basic.getO_paddress());
		basicList.add(basic.getO_wordaddress());
		basicList.add(basic.getO_hphone());
		basicList.add(basic.getO_relperson());
		basicList.add(basic.getO_perphone());
		basicList.add(basic.getO_livetype());
		basicList.add(basic.getO_nationallity());
		basicList.add(basic.getO_culdegree());
		basicList.add(basic.getO_profession());
		basicList.add(basic.getO_marriage());
		basicList.add(basic.getO_medexpense());
		basicList.add(basic.getO_paytype());
		basicList.add(basic.getO_exposehis());
		basicList.add(basic.getO_bloodtype());
		basicList.add(basic.getO_religion());
		db.executeUpdate(basicSql, basicList);
		db.closeAll();
		
		// 自我评估
		EstimateForm estimate = diseaseInfo.getEstimate();
		String estimateSql = "insert into dis_estimate values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
		ArrayList estimateList = new ArrayList();
		estimateList.add(uid);
		estimateList.add(estimate.getEstimate_one());
		estimateList.add(estimate.getEstimate_two());
		estimateList.add(estimate.getEstimate_three());
		estimateList.add(estimate.getEstimate_four());
		estimateList.add(estimate.getEstimate_five());
		estimateList.add(estimate.getEstimate_six());
		estimateList.add(estimate.getEstimate_seven());
		estimateList.add(estimate.getEstimate_eight());
		estimateList.add(estimate.getEstimate_nine());
		estimateList.add(estimate.getEstimate_ten());
		estimateList.add(estimate.getEstimate_eleven());
		estimateList.add(estimate.getEstimate_twelve());
		db.executeUpdate(estimateSql, estimateList);
		db.closeAll();
		// 女性生理
		FemaleForm female = diseaseInfo.getFemale();
		String femaleSql = "insert into dis_female values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		ArrayList femaleList = new ArrayList();
		femaleList.add(uid);
		femaleList.add(female.getFemale_suckle());
		femaleList.add(female.getFemale_week());
		femaleList.add(female.getFemale_menarche());
		femaleList.add(female.getFemale_times());
		femaleList.add(female.getFemale_wedding());
		femaleList.add(female.getFemale_primiparous());
		femaleList.add(female.getMens_week());
		femaleList.add(female.getMens_xjweek());
		femaleList.add(female.getMens_times());
		femaleList.add(female.getBearing_cont());
		femaleList.add(female.getBearing_rctimes());
		femaleList.add(female.getBearing_sytimes());
		femaleList.add(female.getBearing_pctimes());
		femaleList.add(female.getBearing_zrrltimes());
		femaleList.add(female.getBearing_rgrl());
		femaleList.add(female.getBearing_by());
		femaleList.add(female.getBearing_gjsx());
		femaleList.add(female.getBearing_zgqc());
		femaleList.add(female.getBearing_rxqc());
		femaleList.add(female.getBearing_rxjc());
		db.executeUpdate(femaleSql, femaleList);
		db.closeAll();
		
		// 家庭遗传史
		FimilyForm fimil = diseaseInfo.getFimil();
		String fimilSql = "insert into dis_fimily values" +
						"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		ArrayList fimilList = new ArrayList();
		fimilList.add(uid);
		fimilList.add(fimil.getAller_medicine_kef());
		fimilList.add(fimil.getAller_medicine_hair());
		fimilList.add(fimil.getAller_medicine_fruit());
		fimilList.add(fimil.getAller_medicine_dust());
		fimilList.add(fimil.getAller_food_eggs());
		fimilList.add(fimil.getAller_food_seafood());
		fimilList.add(fimil.getAller_food_milk());
		fimilList.add(fimil.getAller_food_pip());
		fimilList.add(fimil.getAller_food_dust());
		fimilList.add(fimil.getAller_food_others());
		fimilList.add(fimil.getInher_bd());
		fimilList.add(fimil.getInher_sugar());
		fimilList.add(fimil.getInher_heartDis());
		fimilList.add(fimil.getInher_gyrus());
		fimilList.add(fimil.getInher_brainknub());
		fimilList.add(fimil.getInher_galactophore());
		fimilList.add(fimil.getInher_venter());
		fimilList.add(fimil.getInher_metabolize());
		fimilList.add(fimil.getInher_others());
		fimilList.add(fimil.getInher_name());
		fimilList.add(fimil.getSend());
		fimilList.add(fimil.getFam_dad());
		fimilList.add(fimil.getFam_mum());
		fimilList.add(fimil.getFam_brother());
		fimilList.add(fimil.getFam_sister());
		fimilList.add(fimil.getDeformity());
		fimilList.add(fimil.getDefor_num());
		db.executeUpdate(fimilSql, fimilList);
		db.closeAll();
		
		// 受伤史
		HurtForm hurt = diseaseInfo.getHurt();
		String hurtSql = "insert into dis_hurt values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		ArrayList hurtList = new ArrayList();
		hurtList.add(uid);
		hurtList.add(hurt.getOp_name());
		hurtList.add(hurt.getOp_time());
		hurtList.add(hurt.getOp_hos());
		hurtList.add(hurt.getOp_scar());
		hurtList.add(hurt.getTrau_name());
		hurtList.add(hurt.getTrau_time());
		hurtList.add(hurt.getTrau_scar());
		hurtList.add(hurt.getBf_times());
		hurtList.add(hurt.getBf_cause());
		hurtList.add(hurt.getBf_time());
		hurtList.add(hurt.getBf_hos());
		hurtList.add(hurt.getBd_times());
		hurtList.add(hurt.getBd_num());
		hurtList.add(hurt.getBd_yn());
		db.executeUpdate(hurtSql, hurtList);
		db.closeAll();
		
		// 生活方式
		LivingForm living = diseaseInfo.getLiving();
		String livingSql = "insert into dis_living values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		ArrayList livingList = new ArrayList();
		livingList.add(uid);
		livingList.add(living.getSmoke_yn());
		livingList.add(living.getSmoke_btime());
		livingList.add(living.getSmoke_etime());
		livingList.add(living.getSmoke_cause());
		livingList.add(living.getSmoke_num());
		livingList.add(living.getPotation_times());
		livingList.add(living.getPotation_type());
		livingList.add(living.getPotation_name());
		livingList.add(living.getPotation_num());
		livingList.add(living.getPotation_age());
		livingList.add(living.getPotation_eage());
		livingList.add(living.getPotation_ago());
		livingList.add(living.getPotation_agonumber());
		livingList.add(living.getPotation_agonum());
		livingList.add(living.getMouth());
		livingList.add(living.getPassivism());
		livingList.add(living.getWork());
		db.executeUpdate(livingSql,livingList);
		db.closeAll();
		
		// 饮食方式
		YinshiForm yinshi = diseaseInfo.getYinshi();
		String yinshiSql = "insert into dis_yinshi values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		ArrayList yinshiList = new ArrayList();
		yinshiList.add(uid);
		yinshiList.add(yinshi.getWorkout_times());
		yinshiList.add(yinshi.getWorkout_day());
		yinshiList.add(yinshi.getWorkout_year());
		yinshiList.add(yinshi.getWorkout_type());
		yinshiList.add(yinshi.getBas_water());
		yinshiList.add(yinshi.getBas_wmuch());
		yinshiList.add(yinshi.getBas_valemuch());
		yinshiList.add(yinshi.getBas_fruitmuch());
		yinshiList.add(yinshi.getBas_meatmuch());
		yinshiList.add(yinshi.getBas_fishmuch());
		yinshiList.add(yinshi.getBas_eggsmuch());
		yinshiList.add(yinshi.getBas_milkmuch());
		yinshiList.add(yinshi.getBas_fat());
		yinshiList.add(yinshi.getBas_sugar());
		yinshiList.add(yinshi.getBas_salt());
		yinshiList.add(yinshi.getBas_type());
		yinshiList.add(yinshi.getBas_weijing());
		yinshiList.add(yinshi.getBas_oil());
		yinshiList.add(yinshi.getBas_nut());
		yinshiList.add(yinshi.getColor());
		db.executeUpdate(yinshiSql, yinshiList);
		db.closeAll();
	}
	
	/**
	 * 删除用户病例信息
	 * @param uid 用户id
	 */
	public void delDiseaseInfo(int uid) {
		String agoSql = "delete from  dis_agodistime where uid=?";
		String basicSql = "delete from dis_basicinfo where uid=?";
		String estimateSql = "delete from dis_estimate where uid=?";
		String femaleSql = "delete from dis_female where uid=?";
		String fimilSql = "delete from dis_fimily where uid=?";
		String hurtSql = "delete from dis_hurt where uid=?";
		String livingSql = "delete from dis_living where uid=?";
		String yinshiSql = "delete from dis_yinshi where uid=?";
		ArrayList list = new ArrayList();
		list.add(uid);
		db.executeUpdate(agoSql, list);
		db.closeAll();
		db.executeUpdate(basicSql, list);
		db.closeAll();
		db.executeUpdate(estimateSql, list);
		db.closeAll();
		db.executeUpdate(femaleSql, list);
		db.closeAll();
		db.executeUpdate(fimilSql, list);
		db.closeAll();
		db.executeUpdate(hurtSql, list);
		db.closeAll();
		db.executeUpdate(livingSql, list);
		db.closeAll();
		db.executeUpdate(yinshiSql, list);
		db.closeAll();
		
	}
	
	/**
	 * 修改用户病例信息
	 * @param diseaseInfo 病例信息
	 */
	public void updateDiseaseInfo(DiseaseInfoForm diseaseInfo) {
		String agoSql = "update dis_agodistime set two_bloodPressure=?,two_diabetes=?," +
						"two_heartDis=?,two_malignancy=?,two_copd=?,two_tuberculosis=?," +
						"two_schiz=?,two_pneumonia=?,two_others=? where uid=?";
		
		String basicSql = "update dis_basicinfo set o_name=?,o_sex=?,o_birth=?," +
							"o_idcard=?,o_paddress=?,o_wordaddress=?,o_hphone=?," +
							"o_relperson=?,o_perphone=?,o_livetype=?,o_nationallity=?," +
							"o_culdegree=?,o_profession=?,o_marriage=?,o_medexpense=?," +
							"o_paytype=?,o_exposehis=?,o_bloodtype=?,o_religion=? where uid=?";
		
		String estimateSql = "update dis_estimate set estimate_one=?,estimate_two=?," +
							"estimate_three=?,estimate_four=?,estimate_five=?,estimate_six=?," +
							"estimate_seven=?,estimate_eight=?,estimate_nine=?,estimate_ten=?," +
							"estimate_eleven=?,estimate_twelve=? where uid=?";
		
		String femaleSql = "update dis_female set female_suckle=?,female_week=?," +
							"female_menarche=?,female_times=?,female_wedding=?," +
							"female_primiparous=?,mens_week=?,mens_xjweek=?," +
							"mens_times=?,bearing_cont=?,bearing_rctimes=?," +
							"bearing_sytimes=?,bearing_pctimes=?,bearing_zrrltimes=?," +
							"bearing_rgrl=?,bearing_by=?,bearing_gjsx=?,bearing_zgqc=?," +
							"bearing_rxqc=?,bearing_rxjc=? where uid=?";
		
		String fimilSql = "update dis_fimily set aller_medicine_kef=?," +
							"aller_medicine_hair=?,aller_medicine_fruit=?," +
							"aller_medicine_dust=?,aller_food_eggs=?," +
							"aller_food_seafood=?,aller_food_milk=?," +
							"aller_food_pip=?,aller_food_dust=?," +
							"aller_food_others=?,inher_bd=?,inher_sugar=?," +
							"inher_heartDis=?,inher_gyrus=?,inher_brainknub=?," +
							"inher_galactophore=?,inher_venter=?,inher_metabolize=?," +
							"inher_others=?,inher_name=?,send=?,fam_dad=?,fam_mum=?," +
							"fam_brother=?,fam_sister=?,deformity=?,defor_num=? where uid=?";
		
		String hurtSql = "update dis_hurt set op_name=?,op_time=?,op_hos=?," +
							"op_scar=?,trau_name=?,trau_time=?,trau_scar=?," +
							"bf_times=?,bf_cause=?,bf_time=?,bf_hos=?," +
							"bd_times=?,bd_num=?,bd_yn=? where uid=?";
		
		String livingSql = "update dis_living set smoke_yn=?,smoke_btime=?," +
							"smoke_etime=?,smoke_cause=?,smoke_num=?,potation_times=?," +
							"potation_type=?,potation_name=?,potation_num=?," +
							"potation_age=?,potation_eage=?,potation_ago=?," +
							"potation_agonumber=?,potation_agonum=?,mouth=?," +
							"passivism=?,work=? where uid=?";
		
		String yinshiSql = "update dis_yinshi set workout_times=?," +
							"workout_day=?,workout_year=?," +
							"workout_type=?,bas_water=?,bas_wmuch=?," +
							"bas_valemuch=?,bas_fruitmuch=?,bas_meatmuch=?," +
							"bas_fishmuch=?,bas_eggsmuch=?,bas_milkmuch=?," +
							"bas_fat=?,bas_sugar=?,bas_salt=?,bas_type=?," +
							"bas_weijing=?,bas_oil=?,bas_nut=?,color=? where uid=?";
		
		ArrayList list = new ArrayList();
		
		list.add(diseaseInfo.getUid());
		
		// 以往病例史
		AgodistimeForm ago = diseaseInfo.getAgo();
		ArrayList agoList = new ArrayList();
		agoList.add(ago.getTwo_bloodPressure());
		agoList.add(ago.getTwo_diabetes());
		agoList.add(ago.getTwo_heartDis());
		agoList.add(ago.getTwo_malignancy());
		agoList.add(ago.getTwo_copd());
		agoList.add(ago.getTwo_tuberculosis());
		agoList.add(ago.getTwo_schiz());
		agoList.add(ago.getTwo_pneumonia());
		agoList.add(ago.getTwo_others());
		agoList.add(diseaseInfo.getUid());
		db.executeUpdate(agoSql, agoList);
		db.closeAll();
		
		// 基本信息表
		BasicInfoForm basic = diseaseInfo.getBasic();
		ArrayList basicList = new ArrayList();
		basicList.add(basic.getO_name());
		basicList.add(basic.getO_sex());
		basicList.add(basic.getO_birth());
		basicList.add(basic.getO_idcard());
		basicList.add(basic.getO_paddress());
		basicList.add(basic.getO_wordaddress());
		basicList.add(basic.getO_hphone());
		basicList.add(basic.getO_relperson());
		basicList.add(basic.getO_perphone());
		basicList.add(basic.getO_livetype());
		basicList.add(basic.getO_nationallity());
		basicList.add(basic.getO_culdegree());
		basicList.add(basic.getO_profession());
		basicList.add(basic.getO_marriage());
		basicList.add(basic.getO_medexpense());
		basicList.add(basic.getO_paytype());
		basicList.add(basic.getO_exposehis());
		basicList.add(basic.getO_bloodtype());
		basicList.add(basic.getO_religion());
		basicList.add(diseaseInfo.getUid());
		db.executeUpdate(basicSql, basicList);
		db.closeAll();
		
		// 自我评估
		EstimateForm estimate = diseaseInfo.getEstimate();
		ArrayList estimateList = new ArrayList();
		estimateList.add(estimate.getEstimate_one());
		estimateList.add(estimate.getEstimate_two());
		estimateList.add(estimate.getEstimate_three());
		estimateList.add(estimate.getEstimate_four());
		estimateList.add(estimate.getEstimate_five());
		estimateList.add(estimate.getEstimate_six());
		estimateList.add(estimate.getEstimate_seven());
		estimateList.add(estimate.getEstimate_eight());
		estimateList.add(estimate.getEstimate_nine());
		estimateList.add(estimate.getEstimate_ten());
		estimateList.add(estimate.getEstimate_eleven());
		estimateList.add(estimate.getEstimate_twelve());
		estimateList.add(diseaseInfo.getUid());
		db.executeUpdate(estimateSql, estimateList);
		db.closeAll();
		// 女性生理
		FemaleForm female = diseaseInfo.getFemale();
		ArrayList femaleList = new ArrayList();
		femaleList.add(female.getFemale_suckle());
		femaleList.add(female.getFemale_week());
		femaleList.add(female.getFemale_menarche());
		femaleList.add(female.getFemale_times());
		femaleList.add(female.getFemale_wedding());
		femaleList.add(female.getFemale_primiparous());
		femaleList.add(female.getMens_week());
		femaleList.add(female.getMens_xjweek());
		femaleList.add(female.getMens_times());
		femaleList.add(female.getBearing_cont());
		femaleList.add(female.getBearing_rctimes());
		femaleList.add(female.getBearing_sytimes());
		femaleList.add(female.getBearing_pctimes());
		femaleList.add(female.getBearing_zrrltimes());
		femaleList.add(female.getBearing_rgrl());
		femaleList.add(female.getBearing_by());
		femaleList.add(female.getBearing_gjsx());
		femaleList.add(female.getBearing_zgqc());
		femaleList.add(female.getBearing_rxqc());
		femaleList.add(female.getBearing_rxjc());
		femaleList.add(diseaseInfo.getUid());
		db.executeUpdate(femaleSql, femaleList);
		db.closeAll();
		
		// 家庭遗传史
		FimilyForm fimil = diseaseInfo.getFimil();
		ArrayList fimilList = new ArrayList();
		fimilList.add(fimil.getAller_medicine_kef());
		fimilList.add(fimil.getAller_medicine_hair());
		fimilList.add(fimil.getAller_medicine_fruit());
		fimilList.add(fimil.getAller_medicine_dust());
		fimilList.add(fimil.getAller_food_eggs());
		fimilList.add(fimil.getAller_food_seafood());
		fimilList.add(fimil.getAller_food_milk());
		fimilList.add(fimil.getAller_food_pip());
		fimilList.add(fimil.getAller_food_dust());
		fimilList.add(fimil.getAller_food_others());
		fimilList.add(fimil.getInher_bd());
		fimilList.add(fimil.getInher_sugar());
		fimilList.add(fimil.getInher_heartDis());
		fimilList.add(fimil.getInher_gyrus());
		fimilList.add(fimil.getInher_brainknub());
		fimilList.add(fimil.getInher_galactophore());
		fimilList.add(fimil.getInher_venter());
		fimilList.add(fimil.getInher_metabolize());
		fimilList.add(fimil.getInher_others());
		fimilList.add(fimil.getInher_name());
		fimilList.add(fimil.getSend());
		fimilList.add(fimil.getFam_dad());
		fimilList.add(fimil.getFam_mum());
		fimilList.add(fimil.getFam_brother());
		fimilList.add(fimil.getFam_sister());
		fimilList.add(fimil.getDeformity());
		fimilList.add(fimil.getDefor_num());
		fimilList.add(diseaseInfo.getUid());
		db.executeUpdate(fimilSql, fimilList);
		db.closeAll();
		
		// 受伤史
		HurtForm hurt = diseaseInfo.getHurt();
		ArrayList hurtList = new ArrayList();
		hurtList.add(hurt.getOp_name());
		hurtList.add(hurt.getOp_time());
		hurtList.add(hurt.getOp_hos());
		hurtList.add(hurt.getOp_scar());
		hurtList.add(hurt.getTrau_name());
		hurtList.add(hurt.getTrau_time());
		hurtList.add(hurt.getTrau_scar());
		hurtList.add(hurt.getBf_times());
		hurtList.add(hurt.getBf_cause());
		hurtList.add(hurt.getBf_time());
		hurtList.add(hurt.getBf_hos());
		hurtList.add(hurt.getBd_times());
		hurtList.add(hurt.getBd_num());
		hurtList.add(hurt.getBd_yn());
		hurtList.add(diseaseInfo.getUid());
		db.executeUpdate(hurtSql, hurtList);
		db.closeAll();
		
		// 生活方式
		LivingForm living = diseaseInfo.getLiving();
		ArrayList livingList = new ArrayList();
		livingList.add(living.getSmoke_yn());
		livingList.add(living.getSmoke_btime());
		livingList.add(living.getSmoke_etime());
		livingList.add(living.getSmoke_cause());
		livingList.add(living.getSmoke_num());
		livingList.add(living.getPotation_times());
		livingList.add(living.getPotation_type());
		livingList.add(living.getPotation_name());
		livingList.add(living.getPotation_num());
		livingList.add(living.getPotation_age());
		livingList.add(living.getPotation_eage());
		livingList.add(living.getPotation_ago());
		livingList.add(living.getPotation_agonumber());
		livingList.add(living.getPotation_agonum());
		livingList.add(living.getMouth());
		livingList.add(living.getPassivism());
		livingList.add(living.getWork());
		livingList.add(diseaseInfo.getUid());
		db.executeUpdate(livingSql,livingList);
		db.closeAll();
		
		// 饮食方式
		YinshiForm yinshi = diseaseInfo.getYinshi();
		ArrayList yinshiList = new ArrayList();
		yinshiList.add(yinshi.getWorkout_times());
		yinshiList.add(yinshi.getWorkout_day());
		yinshiList.add(yinshi.getWorkout_year());
		yinshiList.add(yinshi.getWorkout_type());
		yinshiList.add(yinshi.getBas_water());
		yinshiList.add(yinshi.getBas_wmuch());
		yinshiList.add(yinshi.getBas_valemuch());
		yinshiList.add(yinshi.getBas_fruitmuch());
		yinshiList.add(yinshi.getBas_meatmuch());
		yinshiList.add(yinshi.getBas_fishmuch());
		yinshiList.add(yinshi.getBas_eggsmuch());
		yinshiList.add(yinshi.getBas_milkmuch());
		yinshiList.add(yinshi.getBas_fat());
		yinshiList.add(yinshi.getBas_sugar());
		yinshiList.add(yinshi.getBas_salt());
		yinshiList.add(yinshi.getBas_type());
		yinshiList.add(yinshi.getBas_weijing());
		yinshiList.add(yinshi.getBas_oil());
		yinshiList.add(yinshi.getBas_nut());
		yinshiList.add(yinshi.getColor());
		yinshiList.add(diseaseInfo.getUid());
		db.executeUpdate(yinshiSql, yinshiList);
		db.closeAll();
	}
	
	/**
	 * 封装所有用户病例信息
	 * @return 所有用户病例信息
	 */
	public List<DiseaseInfoForm> getAllDiseaseInfo(ResultSet rs) {
		ArrayList list = new ArrayList();
		
		try {
			while(rs.next()){
				DiseaseInfoForm diseaseInfo = new DiseaseInfoForm();
				
				// 以往病例史
				AgodistimeForm ago = new AgodistimeForm();
				ago.setTwo_bloodPressure(rs.getString("two_bloodPressure"));
				ago.setTwo_diabetes(rs.getString("two_diabetes"));
				ago.setTwo_heartDis(rs.getString("two_heartDis"));
				ago.setTwo_copd(rs.getString("two_malignancy"));
				ago.setTwo_copd(rs.getString("two_copd"));
				ago.setTwo_tuberculosis(rs.getString("two_tuberculosis"));
				ago.setTwo_schiz(rs.getString("two_schiz"));
				ago.setTwo_pneumonia(rs.getString("two_pneumonia"));
				ago.setTwo_others(rs.getString("two_others"));
				diseaseInfo.setAgo(ago);
				
				// 基本信息表
				BasicInfoForm basic = new BasicInfoForm();
				basic.setO_name(rs.getString("o_name"));
				basic.setO_sex(rs.getString("o_sex"));
				basic.setO_birth(rs.getString("o_birth"));
				basic.setO_idcard(rs.getString("o_idcard"));
				basic.setO_paddress(rs.getString("o_paddress"));
				basic.setO_wordaddress(rs.getString("o_wordaddress"));
				basic.setO_hphone(rs.getString("o_hphone"));
				basic.setO_relperson(rs.getString("o_relperson"));
				basic.setO_perphone(rs.getString("o_perphone"));
				basic.setO_livetype(rs.getInt("o_livetype"));
				basic.setO_nationallity(rs.getInt("o_nationallity"));
				basic.setO_culdegree(rs.getInt("o_culdegree"));
				basic.setO_profession(rs.getInt("o_profession"));
				basic.setO_marriage(rs.getInt("o_marriage"));
				basic.setO_medexpense(rs.getInt("o_medexpense"));
				basic.setO_paytype(rs.getInt("o_paytype"));
				basic.setO_exposehis(rs.getInt("o_exposehis"));
				basic.setO_bloodtype(rs.getString("o_bloodtype"));
				basic.setO_religion(rs.getInt("o_religion"));
				diseaseInfo.setBasic(basic);
				
				// 自我评估
				EstimateForm estimate = new EstimateForm();
				estimate.setEstimate_one(rs.getInt("estimate_one"));
				estimate.setEstimate_two(rs.getInt("estimate_two"));
				estimate.setEstimate_three(rs.getInt("estimate_three"));
				estimate.setEstimate_four(rs.getInt("estimate_four"));
				estimate.setEstimate_five(rs.getInt("estimate_five"));
				estimate.setEstimate_six(rs.getInt("estimate_six"));
				estimate.setEstimate_seven(rs.getInt("estimate_seven"));
				estimate.setEstimate_eight(rs.getInt("estimate_eight"));
				estimate.setEstimate_nine(rs.getInt("estimate_nine"));
				estimate.setEstimate_ten(rs.getInt("estimate_ten"));
				estimate.setEstimate_eleven(rs.getInt("estimate_eleven"));
				estimate.setEstimate_twelve(rs.getInt("estimate_twelve"));
				diseaseInfo.setEstimate(estimate);
				
				// 女性生理
				FemaleForm female = new FemaleForm();
				female.setFemale_suckle(rs.getInt("female_suckle"));
				female.setFemale_week(rs.getInt("female_week"));
				female.setFemale_menarche(rs.getInt("female_menarche"));
				female.setFemale_times(rs.getInt("female_times"));
				female.setFemale_wedding(rs.getInt("female_wedding"));
				female.setFemale_primiparous(rs.getInt("female_primiparous"));
				female.setMens_week(rs.getString("mens_week"));
				female.setMens_xjweek(rs.getString("mens_xjweek"));
				female.setMens_times(rs.getInt("mens_times"));
				female.setBearing_cont(rs.getInt("bearing_cont"));
				female.setBearing_rctimes(rs.getInt("bearing_rctimes"));
				female.setBearing_sytimes(rs.getInt("bearing_sytimes"));
				female.setBearing_pctimes(rs.getInt("bearing_pctimes"));
				female.setBearing_zrrltimes(rs.getInt("bearing_zrrltimes"));
				female.setBearing_rgrl(rs.getInt("bearing_rgrl"));
				female.setBearing_by(rs.getInt("bearing_by"));
				female.setBearing_gjsx(rs.getInt("bearing_gjsx"));
				female.setBearing_zgqc(rs.getInt("bearing_zgqc"));
				female.setBearing_rxqc(rs.getInt("bearing_rxqc"));
				female.setBearing_rxjc(rs.getInt("bearing_rxjc"));
				diseaseInfo.setFemale(female);
				
				// 家庭遗传史
				FimilyForm fimil = new FimilyForm();
				fimil.setAller_medicine_kef(rs.getInt("aller_medicine_kef"));
				fimil.setAller_medicine_hair(rs.getInt("aller_medicine_hair"));
				fimil.setAller_medicine_fruit(rs.getInt("aller_medicine_fruit"));
				fimil.setAller_medicine_dust(rs.getInt("aller_medicine_dust"));
				fimil.setAller_food_eggs(rs.getInt("aller_food_eggs"));
				fimil.setAller_food_seafood(rs.getInt("aller_food_seafood"));
				fimil.setAller_food_milk(rs.getInt("aller_food_milk"));
				fimil.setAller_food_pip(rs.getInt("aller_food_pip"));
				fimil.setAller_food_dust(rs.getInt("aller_food_dust"));
				fimil.setAller_food_others(rs.getInt("aller_food_others"));
				fimil.setInher_bd(rs.getInt("inher_bd"));
				fimil.setInher_sugar(rs.getInt("inher_sugar"));
				fimil.setInher_heartDis(rs.getInt("inher_heartDis"));
				fimil.setInher_gyrus(rs.getInt("inher_gyrus"));
				fimil.setInher_brainknub(rs.getInt("inher_brainknub"));
				fimil.setInher_galactophore(rs.getInt("inher_galactophore"));
				fimil.setInher_venter(rs.getInt("inher_venter"));
				fimil.setInher_metabolize(rs.getInt("inher_metabolize"));
				fimil.setInher_others(rs.getInt("inher_others"));
				fimil.setInher_name(rs.getString("inher_name"));
				fimil.setSend(rs.getString("send"));
				fimil.setFam_dad(rs.getInt("fam_dad"));
				fimil.setFam_mum(rs.getInt("fam_mum"));
				fimil.setFam_brother(rs.getInt("fam_brother"));
				fimil.setFam_sister(rs.getInt("fam_sister"));
				fimil.setDeformity(rs.getInt("deformity"));
				fimil.setDefor_num(rs.getString("defor_num"));
				diseaseInfo.setFimil(fimil);
				
				// 受伤史
				HurtForm hurt = new HurtForm();
				hurt.setOp_name(rs.getString("op_name"));
				hurt.setOp_time(rs.getString("op_time"));
				hurt.setOp_hos(rs.getString("op_hos"));
				hurt.setOp_scar(rs.getString("op_scar"));
				hurt.setTrau_name(rs.getString("trau_name"));
				hurt.setTrau_time(rs.getString("trau_time"));
				hurt.setTrau_scar(rs.getString("trau_scar"));
				hurt.setBf_times(rs.getInt("bf_times"));
				hurt.setBf_cause(rs.getString("bf_cause"));
				hurt.setBf_time(rs.getString("bf_time"));
				hurt.setBf_hos(rs.getString("bf_hos"));
				hurt.setBd_times(rs.getInt("bd_times"));
				hurt.setBd_num(rs.getString("bd_num"));
				hurt.setBd_yn(rs.getInt("bd_yn"));
				diseaseInfo.setHurt(hurt);
				
				// 生活方式
				LivingForm living = new LivingForm();
				living.setSmoke_yn(rs.getInt("smoke_yn"));
				living.setSmoke_btime(rs.getInt("smoke_btime"));
				living.setSmoke_etime(rs.getInt("smoke_etime"));
				living.setSmoke_cause(rs.getString("smoke_cause"));
				living.setSmoke_num(rs.getInt("smoke_num"));
				living.setPotation_times(rs.getInt("potation_times"));
				living.setPotation_type(rs.getInt("potation_type"));
				living.setPotation_name(rs.getString("potation_name"));
				living.setPotation_num(rs.getInt("potation_num"));
				living.setPotation_age(rs.getInt("potation_age"));
				living.setPotation_eage(rs.getInt("potation_eage"));
				living.setPotation_ago(rs.getInt("potation_ago"));
				living.setPotation_agonumber(rs.getString("potation_agonumber"));
				living.setPotation_agonum(rs.getInt("potation_agonum"));
				living.setMouth(rs.getInt("mouth"));
				living.setPassivism(rs.getInt("passivism"));
				living.setWork(rs.getInt("work"));
				diseaseInfo.setLiving(living);
				
				// 饮食方式
				YinshiForm yinshi = new YinshiForm();
				yinshi.setWorkout_times(rs.getInt("workout_times"));
				yinshi.setWorkout_day(rs.getInt("workout_day"));
				yinshi.setWorkout_year(rs.getInt("workout_year"));
				yinshi.setWorkout_type(rs.getInt("workout_type"));
				yinshi.setBas_water(rs.getInt("bas_water"));
				yinshi.setBas_wmuch(rs.getInt("bas_wmuch"));
				yinshi.setBas_valemuch(rs.getInt("bas_valemuch"));
				yinshi.setBas_fruitmuch(rs.getInt("bas_fruitmuch"));
				yinshi.setBas_meatmuch(rs.getInt("bas_meatmuch"));
				yinshi.setBas_fishmuch(rs.getInt("bas_fishmuch"));
				yinshi.setBas_eggsmuch(rs.getInt("bas_eggsmuch"));
				yinshi.setBas_milkmuch(rs.getInt("bas_milkmuch"));
				yinshi.setBas_fat(rs.getInt("bas_fat"));
				yinshi.setBas_sugar(rs.getInt("bas_sugar"));
				yinshi.setBas_salt(rs.getInt("bas_salt"));
				yinshi.setBas_type(rs.getInt("bas_type"));
				yinshi.setBas_weijing(rs.getInt("bas_weijing"));
				yinshi.setBas_oil(rs.getInt("bas_oil"));
				yinshi.setBas_nut(rs.getInt("bas_nut"));
				yinshi.setColor(rs.getInt("color"));
				diseaseInfo.setYinshi(yinshi);
				
				diseaseInfo.setUid(rs.getInt("uid"));
				list.add(diseaseInfo);
			}
		} catch (SQLException e) {
			log.error(e.getMessage());
		} finally {
			db.closeAll();
		}
		return list;
	}

	/**
	 * 得到所有用户病例信息
	 * @return 所有用户病例信息
	 */
	public DiseaseInfoForm getDiseaseInfo(int uid) {
		String agoSql = "select * from  dis_agodistime where uid=?";
		String basicSql = "select * from dis_basicinfo where uid=?";
		String estimateSql = "select * from dis_estimate where uid=?";
		String femaleSql = "select * from dis_female where uid=?";
		String fimilSql = "select * from dis_fimily where uid=?";
		String hurtSql = "select * from dis_hurt where uid=?";
		String livingSql = "select * from dis_living where uid=?";
		String yinshiSql = "select * from dis_yinshi where uid=?";
		DiseaseInfoForm diseaseInfo = new DiseaseInfoForm();
		
		ArrayList list = new ArrayList();
		list.add(uid);
		
		diseaseInfo.setUid(uid);
		
		// 以往病例史
		ResultSet agoRs = db.executeQuery(agoSql, list);
		AgodistimeForm ago = this.getAgodistimeBean(agoRs);
		diseaseInfo.setAgo(ago);
		// 基本信息表
		ResultSet basicRs = db.executeQuery(basicSql, list);
		BasicInfoForm basic = this.getBasicInfoBean(basicRs);
		diseaseInfo.setBasic(basic);
		// 自我评估
		ResultSet estimateRs = db.executeQuery(estimateSql, list);
		EstimateForm estimate = this.getEstimateBean(estimateRs);
		diseaseInfo.setEstimate(estimate);
		// 女性生理
		ResultSet femaleRs = db.executeQuery(femaleSql, list);
		FemaleForm female = this.getFemaleBean(femaleRs);
		diseaseInfo.setFemale(female);
		// 家庭遗传史
		ResultSet fimilRs = db.executeQuery(fimilSql, list);
		FimilyForm fimil = this.getFimilyBean(fimilRs);
		diseaseInfo.setFimil(fimil);
		// 受伤史
		ResultSet hurtRs = db.executeQuery(hurtSql, list);
		HurtForm hurt = this.getHurtBean(hurtRs);
		diseaseInfo.setHurt(hurt);
		// 生活方式
		ResultSet livingRs = db.executeQuery(livingSql, list);
		LivingForm living = this.getLivingBean(livingRs);
		diseaseInfo.setLiving(living);
		// 饮食方式
		ResultSet yinshiRs = db.executeQuery(yinshiSql, list);
		YinshiForm yinshi = this.getYinshiBean(yinshiRs);
		diseaseInfo.setYinshi(yinshi);
		return diseaseInfo;
	}
	
	private AgodistimeForm getAgodistimeBean(ResultSet agoRs){
		AgodistimeForm ago = new AgodistimeForm();
		try {
			if(agoRs.next()){
				
				// 以往病例史
				ago.setTwo_bloodPressure(agoRs.getString("two_bloodPressure"));
				ago.setTwo_diabetes(agoRs.getString("two_diabetes"));
				ago.setTwo_heartDis(agoRs.getString("two_heartDis"));
				ago.setTwo_malignancy(agoRs.getString("two_malignancy"));
				ago.setTwo_copd(agoRs.getString("two_copd"));
				ago.setTwo_tuberculosis(agoRs.getString("two_tuberculosis"));
				ago.setTwo_schiz(agoRs.getString("two_schiz"));
				ago.setTwo_pneumonia(agoRs.getString("two_pneumonia"));
				ago.setTwo_others(agoRs.getString("two_others"));
				
			}
		} catch (SQLException e) {
			log.error(e.getMessage());
		} finally {
			db.closeAll();
		}
		return ago;
	}
	
	private BasicInfoForm getBasicInfoBean(ResultSet basicRs){
		BasicInfoForm basic = new BasicInfoForm();
		try {
			if(basicRs.next()){
				// 基本信息表
				basic.setO_name(basicRs.getString("o_name"));
				basic.setO_sex(basicRs.getString("o_sex"));
				basic.setO_birth(basicRs.getString("o_birth"));
				basic.setO_idcard(basicRs.getString("o_idcard"));
				basic.setO_paddress(basicRs.getString("o_paddress"));
				basic.setO_wordaddress(basicRs.getString("o_wordaddress"));
				basic.setO_hphone(basicRs.getString("o_hphone"));
				basic.setO_relperson(basicRs.getString("o_relperson"));
				basic.setO_perphone(basicRs.getString("o_perphone"));
				basic.setO_livetype(basicRs.getInt("o_livetype"));
				basic.setO_nationallity(basicRs.getInt("o_nationallity"));
				basic.setO_culdegree(basicRs.getInt("o_culdegree"));
				basic.setO_profession(basicRs.getInt("o_profession"));
				basic.setO_marriage(basicRs.getInt("o_marriage"));
				basic.setO_medexpense(basicRs.getInt("o_medexpense"));
				basic.setO_paytype(basicRs.getInt("o_paytype"));
				basic.setO_exposehis(basicRs.getInt("o_exposehis"));
				basic.setO_bloodtype(basicRs.getString("o_bloodtype"));
				basic.setO_religion(basicRs.getInt("o_religion"));
				
			}
		} catch (SQLException e) {
			log.error(e.getMessage());
		} finally {
			db.closeAll();
		}
		return basic;
	}
	
	private EstimateForm getEstimateBean(ResultSet estimateRs){
		EstimateForm estimate = new EstimateForm();
		try {
			if(estimateRs.next()){
				// 自我评估
				estimate.setEstimate_one(estimateRs.getInt("estimate_one"));
				estimate.setEstimate_two(estimateRs.getInt("estimate_two"));
				estimate.setEstimate_three(estimateRs.getInt("estimate_three"));
				estimate.setEstimate_four(estimateRs.getInt("estimate_four"));
				estimate.setEstimate_five(estimateRs.getInt("estimate_five"));
				estimate.setEstimate_six(estimateRs.getInt("estimate_six"));
				estimate.setEstimate_seven(estimateRs.getInt("estimate_seven"));
				estimate.setEstimate_eight(estimateRs.getInt("estimate_eight"));
				estimate.setEstimate_nine(estimateRs.getInt("estimate_nine"));
				estimate.setEstimate_ten(estimateRs.getInt("estimate_ten"));
				estimate.setEstimate_eleven(estimateRs.getInt("estimate_eleven"));
				estimate.setEstimate_twelve(estimateRs.getInt("estimate_twelve"));
				
			}
		} catch (SQLException e) {
			log.error(e.getMessage());
		} finally {
			db.closeAll();
		}
		return estimate;
	}
	
	private FemaleForm getFemaleBean(ResultSet femaleRs){
		FemaleForm female = new FemaleForm();
		try {
			if(femaleRs.next()){
				// 女性生理
				female.setFemale_suckle(femaleRs.getInt("female_suckle"));
				female.setFemale_week(femaleRs.getInt("female_week"));
				female.setFemale_menarche(femaleRs.getInt("female_menarche"));
				female.setFemale_times(femaleRs.getInt("female_times"));
				female.setFemale_wedding(femaleRs.getInt("female_wedding"));
				female.setFemale_primiparous(femaleRs.getInt("female_primiparous"));
				female.setMens_week(femaleRs.getString("mens_week"));
				female.setMens_xjweek(femaleRs.getString("mens_xjweek"));
				female.setMens_times(femaleRs.getInt("mens_times"));
				female.setBearing_cont(femaleRs.getInt("bearing_cont"));
				female.setBearing_rctimes(femaleRs.getInt("bearing_rctimes"));
				female.setBearing_sytimes(femaleRs.getInt("bearing_sytimes"));
				female.setBearing_pctimes(femaleRs.getInt("bearing_pctimes"));
				female.setBearing_zrrltimes(femaleRs.getInt("bearing_zrrltimes"));
				female.setBearing_rgrl(femaleRs.getInt("bearing_rgrl"));
				female.setBearing_by(femaleRs.getInt("bearing_by"));
				female.setBearing_gjsx(femaleRs.getInt("bearing_gjsx"));
				female.setBearing_zgqc(femaleRs.getInt("bearing_zgqc"));
				female.setBearing_rxqc(femaleRs.getInt("bearing_rxqc"));
				female.setBearing_rxjc(femaleRs.getInt("bearing_rxjc"));
			}
		} catch (SQLException e) {
			log.error(e.getMessage());
		} finally {
			db.closeAll();
		}
		return female;
	}
	
	private FimilyForm getFimilyBean(ResultSet fimilRs){
		FimilyForm fimil = new FimilyForm();
		try {
			if(fimilRs.next()){
				// 家庭遗传史
				fimil.setAller_medicine_kef(fimilRs.getInt("aller_medicine_kef"));
				fimil.setAller_medicine_hair(fimilRs.getInt("aller_medicine_hair"));
				fimil.setAller_medicine_fruit(fimilRs.getInt("aller_medicine_fruit"));
				fimil.setAller_medicine_dust(fimilRs.getInt("aller_medicine_dust"));
				fimil.setAller_food_eggs(fimilRs.getInt("aller_food_eggs"));
				fimil.setAller_food_seafood(fimilRs.getInt("aller_food_seafood"));
				fimil.setAller_food_milk(fimilRs.getInt("aller_food_milk"));
				fimil.setAller_food_pip(fimilRs.getInt("aller_food_pip"));
				fimil.setAller_food_dust(fimilRs.getInt("aller_food_dust"));
				fimil.setAller_food_others(fimilRs.getInt("aller_food_others"));
				fimil.setInher_bd(fimilRs.getInt("inher_bd"));
				fimil.setInher_sugar(fimilRs.getInt("inher_sugar"));
				fimil.setInher_heartDis(fimilRs.getInt("inher_heartDis"));
				fimil.setInher_gyrus(fimilRs.getInt("inher_gyrus"));
				fimil.setInher_brainknub(fimilRs.getInt("inher_brainknub"));
				fimil.setInher_galactophore(fimilRs.getInt("inher_galactophore"));
				fimil.setInher_venter(fimilRs.getInt("inher_venter"));
				fimil.setInher_metabolize(fimilRs.getInt("inher_metabolize"));
				fimil.setInher_others(fimilRs.getInt("inher_others"));
				fimil.setInher_name(fimilRs.getString("inher_name"));
				fimil.setSend(fimilRs.getString("send"));
				fimil.setFam_dad(fimilRs.getInt("fam_dad"));
				fimil.setFam_mum(fimilRs.getInt("fam_mum"));
				fimil.setFam_brother(fimilRs.getInt("fam_brother"));
				fimil.setFam_sister(fimilRs.getInt("fam_sister"));
				fimil.setDeformity(fimilRs.getInt("deformity"));
				fimil.setDefor_num(fimilRs.getString("defor_num"));
				
			}
		} catch (SQLException e) {
			log.error(e.getMessage());
		} finally {
			db.closeAll();
		}
		return fimil;
	}
	
	private HurtForm getHurtBean(ResultSet hurtRs){
		HurtForm hurt = new HurtForm();
		try {
			if(hurtRs.next()){
				// 受伤史
				hurt.setOp_name(hurtRs.getString("op_name"));
				hurt.setOp_time(hurtRs.getString("op_time"));
				hurt.setOp_hos(hurtRs.getString("op_hos"));
				hurt.setOp_scar(hurtRs.getString("op_scar"));
				hurt.setTrau_name(hurtRs.getString("trau_name"));
				hurt.setTrau_time(hurtRs.getString("trau_time"));
				hurt.setTrau_scar(hurtRs.getString("trau_scar"));
				hurt.setBf_times(hurtRs.getInt("bf_times"));
				hurt.setBf_cause(hurtRs.getString("bf_cause"));
				hurt.setBf_time(hurtRs.getString("bf_time"));
				hurt.setBf_hos(hurtRs.getString("bf_hos"));
				hurt.setBd_times(hurtRs.getInt("bd_times"));
				hurt.setBd_num(hurtRs.getString("bd_num"));
				hurt.setBd_yn(hurtRs.getInt("bd_yn"));
				
			}
		} catch (SQLException e) {
			log.error(e.getMessage());
		} finally {
			db.closeAll();
		}
		return hurt;
	}
	
	private LivingForm getLivingBean(ResultSet livingRs){
		LivingForm living = new LivingForm();
	try {
		if(livingRs.next()){
			// 生活方式
			living.setSmoke_yn(livingRs.getInt("smoke_yn"));
			living.setSmoke_btime(livingRs.getInt("smoke_btime"));
			living.setSmoke_etime(livingRs.getInt("smoke_etime"));
			living.setSmoke_cause(livingRs.getString("smoke_cause"));
			living.setSmoke_num(livingRs.getInt("smoke_num"));
			living.setPotation_times(livingRs.getInt("potation_times"));
			living.setPotation_type(livingRs.getInt("potation_type"));
			living.setPotation_name(livingRs.getString("potation_name"));
			living.setPotation_num(livingRs.getInt("potation_num"));
			living.setPotation_age(livingRs.getInt("potation_age"));
			living.setPotation_eage(livingRs.getInt("potation_eage"));
			living.setPotation_ago(livingRs.getInt("potation_ago"));
			living.setPotation_agonumber(livingRs.getString("potation_agonumber"));
			living.setPotation_agonum(livingRs.getInt("potation_agonum"));
			living.setMouth(livingRs.getInt("mouth"));
			living.setPassivism(livingRs.getInt("passivism"));
			living.setWork(livingRs.getInt("work"));
			
		}
	} catch (SQLException e) {
		log.error(e.getMessage());
	} finally {
		db.closeAll();
	}
	return living;
	}
	
	private YinshiForm getYinshiBean(ResultSet yinshiRs){
		YinshiForm yinshi = new YinshiForm();
		try {
			if(yinshiRs.next()){
				// 饮食方式
				yinshi.setWorkout_times(yinshiRs.getInt("workout_times"));
				yinshi.setWorkout_day(yinshiRs.getInt("workout_day"));
				yinshi.setWorkout_year(yinshiRs.getInt("workout_year"));
				yinshi.setWorkout_type(yinshiRs.getInt("workout_type"));
				yinshi.setBas_water(yinshiRs.getInt("bas_water"));
				yinshi.setBas_wmuch(yinshiRs.getInt("bas_wmuch"));
				yinshi.setBas_valemuch(yinshiRs.getInt("bas_valemuch"));
				yinshi.setBas_fruitmuch(yinshiRs.getInt("bas_fruitmuch"));
				yinshi.setBas_meatmuch(yinshiRs.getInt("bas_meatmuch"));
				yinshi.setBas_fishmuch(yinshiRs.getInt("bas_fishmuch"));
				yinshi.setBas_eggsmuch(yinshiRs.getInt("bas_eggsmuch"));
				yinshi.setBas_milkmuch(yinshiRs.getInt("bas_milkmuch"));
				yinshi.setBas_fat(yinshiRs.getInt("bas_fat"));
				yinshi.setBas_sugar(yinshiRs.getInt("bas_sugar"));
				yinshi.setBas_salt(yinshiRs.getInt("bas_salt"));
				yinshi.setBas_type(yinshiRs.getInt("bas_type"));
				yinshi.setBas_weijing(yinshiRs.getInt("bas_weijing"));
				yinshi.setBas_oil(yinshiRs.getInt("bas_oil"));
				yinshi.setBas_nut(yinshiRs.getInt("bas_nut"));
				yinshi.setColor(yinshiRs.getInt("color"));
			}
		} catch (SQLException e) {
			log.error(e.getMessage());
		} finally {
			db.closeAll();
		}
		return yinshi;
	}

}
